package com.wanmait.community.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;

/**
 * 房屋账户表
 */
@Data
@Accessors(chain = true)
@TableName(value = "account")
public class Account {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 房屋id
     */
    @TableField(value = "room_id")
    @NotNull(message = "必须要跟房间绑定")
    private Integer roomId;

    /**
     * 余额
     */
    @TableField(value = "balance")
    @NotNull(message = "余额不能为空") // 确保非空
    @DecimalMin(value = "0.00", inclusive = false, message = "余额必须大于0") // 确保 > 0
    private BigDecimal balance;

    /**
     * 创建用户id
     */
    @TableField(value = "creat_by")
    private Integer creatBy;

    /**
     * 创建时间
     */
    @TableField(value = "creat_time")
    private Date creatTime;

    /**
     * 更新用户id
     */
    @TableField(value = "update_by")
    private Integer updateBy;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private Date updateTime;

    /**
     * 备注
     */
    @TableField(value = "remark")
    private String remark;

    /**
     * 逻辑删除
     */
    @TableField(value = "`enable`")
    private Boolean enable;
}